package com.yellowpage.common;

import java.io.IOException;
import java.util.Date;

import com.yellowpage.ca.service.UserService;
import com.yellowpage.white.common.Constants;
import com.yellowpage.white.struts.BaseAction;

public class LoginAction extends BaseAction {

	public String RESULT_CHECK_IN="checkIn";
	public String RESULT_CHECK_OUT="checkOut";
	
	private UserService userService;	

	public String checkIn() {
		loginUser.setLastLoginTime(new Date());
		userService.updateUser(loginUser);
		log("", "", "用户:"
				+ session.get(Constants.get("USER_LOGINNAME")) + "登录到IDC监控系统");
		return RESULT_CHECK_IN;
	}

	public String checkOut() throws IOException {		
		this.session.clear();
		return RESULT_CHECK_OUT;
	}

	/**
	 * getters and setters
	 * 
	 * @return
	 */

	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	
	
}
